from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sys
class lineditDemo(QWidget):
    def __init__(self,parent=None):
        super(lineditDemo,self).__init__(parent)
        self.setWindowTitle("Qlinedit例子")
        flo=QFormLayout()

        PipLinedit=QLineEdit()
        PmacLinedit=QLineEdit()
        PdateLinedit=QLineEdit()
        PLicenseLineEdit=QLineEdit()
        PipLinedit.setInputMask("000.000.000.000;_")
        PmacLinedit.setInputMask("HH:HH:HH:HH:HH:HH;_")
        PdateLinedit.setInputMask("0000-00-00")
        PLicenseLineEdit.setInputMask(">AAA-AAA-bbb;#")
        flo.addRow("数字掩码",PipLinedit)
        flo.addRow("Mac掩码",PmacLinedit)
        flo.addRow("日期掩码",PdateLinedit)
        flo.addRow("许可证掩码",PLicenseLineEdit)
        self.setLayout(flo)
if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = lineditDemo()
    win.show()
    sys.exit(app.exec_())